package com.bwf.lgqingdan.gui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bwf.lgqingdan.R;
import com.bwf.lgqingdan.entity.ResponseCategoryThing;
import com.bwf.lgqingdan.gui.adapter.base.BaseRecycleViewAdapter;
import com.facebook.drawee.view.SimpleDraweeView;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/11/16.
 */

public class CategoryThingRelatedTagsAdapter extends BaseRecycleViewAdapter<ResponseCategoryThing.TagDetailsRelatedTagsBean.BodyBean.RelatedTagsData.RelatedTagsBean> {
    public CategoryThingRelatedTagsAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getHeaderItemCount() {
        return 0;
    }

    @Override
    protected int getFooterItemCount() {
        return 0;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflaterView(R.layout.list_item_category_thing_related_tags, parent);
        return new ItemViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ResponseCategoryThing.TagDetailsRelatedTagsBean.BodyBean.RelatedTagsData.RelatedTagsBean tagsBean = getItem(position);
        ItemViewHolder itemViewHolder = (ItemViewHolder) holder;
        itemViewHolder.imgItemRelatedTagsCover.setImageURI(tagsBean.getCoverImage().getThumbnail().getImageUrl());
        itemViewHolder.tvItemRelatedTagsName.setText(tagsBean.getName());
    }

     class ItemViewHolder extends BaseViewHolder{
        @BindView(R.id.img_item_related_tags_cover)
        SimpleDraweeView imgItemRelatedTagsCover;
        @BindView(R.id.tv_item_related_tags_name)
        TextView tvItemRelatedTagsName;

        ItemViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
